#ifndef __WEEDER_MAP_POINT_H
#define __WEEDER_MAP_POINT_H

#include <TooN/TooN.h>

class WeederMapPoint
{
public:
  WeederMapPoint(const int nNumberClasses)
  {
    nNumClasses = nNumberClasses;
    nClassLabel = -1;
    pdClassProb = new double[nNumberClasses];
    memset(pdClassProb, 0, nNumberClasses*sizeof(double));
    pnClassCount = new int[nNumberClasses];
    memset(pnClassCount, 0, nNumberClasses*sizeof(int));
  }

  ~WeederMapPoint()
  {
    delete [] pdClassProb;
  }

  TooN::Vector<3> v3WorldPos;
  TooN::Vector<3> v3Normal;
  int nClassLabel;
  int nNumClasses;
  double *pdClassProb;
  int *pnClassCount;

  void SetAssigned()
  {
    ctype = ASSIGNED;
  }

  bool IsAssigned()
  {
    return (ctype == ASSIGNED);
  }

  void SetUnAssigned()
  {
    ctype = UNASSIGNED;
  }

  bool IsUnAssigned()
  {
    return (ctype == UNASSIGNED);
  }

  void SetNoise()
  {
    ctype = NOISE;
  }

  bool IsNoise()
  {
    return (ctype == NOISE);
  }

private:
  enum ClusterType { UNASSIGNED, NOISE, ASSIGNED };
  ClusterType ctype;

  // Do not allow copy
  WeederMapPoint(const WeederMapPoint& k);
  WeederMapPoint& operator=(const WeederMapPoint&);
};

double SquaredDistance(WeederMapPoint* mpt1, WeederMapPoint* mpt2)
{
  TooN::Vector<3> v3Diff = mpt1->v3WorldPos - mpt2->v3WorldPos;
  return(v3Diff*v3Diff);
}

#endif
